package nccloud.impl.bd.Tradetail;

import java.util.List;

import nc.bs.dao.BaseDAO;
import nc.impl.obm.pub.tradetail.AceTradetailPubServiceImpl;
import nc.impl.pubapp.pattern.data.vo.VOQuery;
import nc.impl.pubapp.pub.smart.BatchSaveAction;
import nc.jdbc.framework.SQLParameter;
import nc.jdbc.framework.processor.ColumnListProcessor;
import nc.ui.querytemplate.querytree.IQueryScheme;
import nc.vo.bd.meta.BatchOperateVO;
import nc.vo.obm.tradetail.TradetailVO;
import nc.vo.pub.BusinessException;
import nccloud.itf.bd.Tradetail.ITraDetailMaintain;

public class TraDetailMaintainImpl extends AceTradetailPubServiceImpl implements ITraDetailMaintain {

	@Override
	public TradetailVO[] query(IQueryScheme queryScheme) throws BusinessException {
		return super.pubquerybasedoc(queryScheme);
	}

	@Override
	public BatchOperateVO batchSave(BatchOperateVO batchVO) throws BusinessException {
		BatchSaveAction<TradetailVO> saveAction = new BatchSaveAction<TradetailVO>();
		BatchOperateVO retData = saveAction.batchSave(batchVO);
		return retData;
	}

	@Override
	public Object[] queryObjectByPKs(String[] pks) throws BusinessException {
		VOQuery<TradetailVO> qry = new VOQuery<TradetailVO>(TradetailVO.class);
		return qry.query(pks);
	}

	@Override
	public List<String> queryPKsByCause(String sqlWhere, String pk_group, String pk_org) throws BusinessException {
		String sql = "select pk_tradetail from obm_tradetail where pk_group=? and dr=0 and " + sqlWhere;
		SQLParameter p = new SQLParameter();
		p.addParam(pk_group);
		List<String> ls = (List<String>) new BaseDAO().executeQuery(sql, p, new ColumnListProcessor());

		return ls;
	}

}
